<!--
 * @Description: helloworld
 * @Author: zugelu
 * @Date: 2021-07-27 13:58:29
 * @LastEditors: zugelu
 * @LastEditTime: 2021-07-27 15:30:54
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="test"></div>
</body>
<script src="../js/react.development.js"></script>
<script src="../js/react-dom.development.js"></script>
<script src="../js/babel.min.js"></script>

<script type="text/babel">
    // const VDOM = '<h1>hello world !</h1>' // error
    const Vid = "hello"
    const VDOM = (
        <div>
            <h1 id={Vid}>hello world !</h1>
            <h1 className="nihao" style={{ color: 'red', fontSize: '20px' }}>hello world !</h1>
            <input type="text" />
        </div>
    )
    ReactDOM.render(VDOM, document.querySelector("#test"))

    /*
        1.定义虚拟DOM，不要写引号
        2.标签中混入JS表达式时要用{}
        3.样式的类名指定不要用class，要用className
        4.内联样式，要用style={{key:value}}的形式
        5.只有一个根标签
        6.标签必须闭合
        7.标签首字母
          - 若首字母小写，则将该标签转为html中同名元素，若html中无对应的同名元素，则报错
          - 若首字母大写，react就去渲染对应的组件，若组件没有被定义，则报错
    */
</script>

</html>